package cn.j0n4than.accountingtool.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 消费实体类
 *
 * @author jonathan
 */
@TableName(value = "spending", keepGlobalPrefix = true)
public class Spending {

    @TableId(type = IdType.AUTO)
    public Integer id;

    @TableField("user_id")
    public Integer userId;

    @TableField("amount")
    public BigDecimal amount;

    @TableField("type_id")
    public Integer typeId;

    @TableField("note")
    public String note;

    @TableField("spent_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date spentAt;

    @TableField("created_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date createdAt;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date startTime;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date endTime;

    @TableField(exist = false)
    public BigDecimal sumAmount;

    @TableField(exist = false)
    public String type;

    @TableField(exist = false)
    public String style;

    @TableField(exist = false)
    public String icon;

    @Override
    public String toString() {
        return "Spending{" +
                "id=" + id +
                ", userId=" + userId +
                ", amount=" + amount +
                ", typeId=" + typeId +
                ", note='" + note + '\'' +
                ", spentAt=" + spentAt +
                ", createdAt=" + createdAt +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", sumAmount=" + sumAmount +
                ", type='" + type + '\'' +
                ", style='" + style + '\'' +
                ", icon='" + icon + '\'' +
                '}';
    }
}
